<html>
<body>
<table>
	<head> Player 1 - Defense </head>
	<tr>
		<?php foreach($trump as $t): ?>
		<td rowspan=3> <img src = "<?php echo $this->config->item('base_url').'/images/'.$t['suit_id'].'_'.$t['face'].'.png' ?>"> </td>
	<?php
		endforeach;
		foreach($second as $card):
	?>
			<td>
				<img src = "<?php echo $this->config->item('base_url').'/images/b1fv.png' ?>">
			</td>
	<?php endforeach; ?>
	</tr>
	<tr>
	<?php
		if(count($table) != 0)
		{
			foreach($table as $card):
	?>
				<td> 
					<img src = "<?php echo $this->config->item('base_url').'/images/'.$card['suit_id'].'_'.$card['face'].'.png' ?>"> 
				</td>
	<?php
			endforeach;
		}
	?>
	</tr>
	<tr>
	<?php
		$index = 0;
		$attack = end($table);
		$suit = $t['suit_id'];
		$attack['face'] = intval($attack['face']);
		$card['face'] = intval($card['face']);
		foreach($first as $card):
			if($attack['suit_id'] == $card['suit_id'])
			{
				if($card['face'] > $attack['face'])
				{
	?>
			<td> 
				<a href = "<?php echo site_url('/durak/set_defense/1').'/'.$index ?>">
				<img src = "<?php echo $this->config->item('base_url').'/images/'.$card['suit_id'].'_'.$card['face'].'.png' ?>"> 
				</a>
			</td>
	<?php
				}
				else
				{
	?>	
					<td> 
						<img src = "<?php echo $this->config->item('base_url').'/images/'.$card['suit_id'].'_'.$card['face'].'.png' ?>"> 
					</td>
	<?php			
				}
			}
			else
			{
				if($card['suit_id'] == $suit)
				{
	?>
					<td> 
						<a href = "<?php echo site_url('/durak/set_defense/1').'/'.$index ?>">
						<img src = "<?php echo $this->config->item('base_url').'/images/'.$card['suit_id'].'_'.$card['face'].'.png' ?>"> 
						</a>
					</td>
	<?php
				}
				else
				{
	?>
					<td> 
						<img src = "<?php echo $this->config->item('base_url').'/images/'.$card['suit_id'].'_'.$card['face'].'.png' ?>"> 
					</td>
	<?php
				}
			}
			$index++;
			endforeach;
	?>
	</tr>
	<tr>
		<td colspan="<?php echo $index ?>">
			<a href="<?php echo site_url('/durak/set_accept/1') ?>">
		  		Accept
		  	</a>
		</td>
	</tr>
</body>
</html>